import Vue from 'vue'
import VueRouter from 'vue-router'
import Shopbag from "@/views/shopbag/index.vue";
import My from "@/views/my/index.vue"
import productDetails from "@/views/products/productDetails.vue";
import SearchDetail from "@/components/SearchDetail.vue"
import PersonalData from "@/views/my/personalData.vue";
import MyCollection from "@/views/my/myCollection.vue";
import AddressManagement from "@/views/my/addressManagement.vue";
import AddAddress from "@/views/my/addAddress.vue";
import EditAddress from "@/views/my/editAddress.vue";
import OrderSettlement from "@/views/shopbag/orderSettlement.vue";
import MyOrder from "@/views/my/myOrder.vue";
import SecurityCenter from "@/views/my/securityCenter.vue";
import Login from "@/views/my/login.vue";

Vue.use(VueRouter)


const routes = [
	{
		path: '/',
		redirect: "/home"
	},
	{
		path: '/home',
		name: 'home',
		// 路由懒加载
		component: () => import('@/views/Home.vue')
	},
	{
		path: '/menus',
		name: 'menus',
		component: () => import('@/views/menus/index.vue'),
	},
	{
		path: '/shopbag',
		name: 'shopbag',
		component: Shopbag,
	},
	{
		path: '/my',
		name: 'my',
		component: My,
		meta: {
			tabber: true
		}
	}, {
		path: '/login',
		name: 'login',
		component: Login,
		meta: {
			tabber: false
		}
	}, {
		path: '/personalData',
		name: 'personalData',
		component: PersonalData,
		meta: {
			tabber: false
		}
	}, {
		path: '/orderSettlement',
		name: 'orderSettlement',
		component: OrderSettlement,
		meta: {
			tabber: false
		}
	}, {
		path: '/securityCenter',
		name: 'securityCenter',
		component: SecurityCenter,
		meta: {
			tabber: false
		}
	}, {
		path: '/myCollection',
		name: 'myCollection',
		component: MyCollection,
		meta: {
			tabber: false
		}
	}, {
		path: '/addressManagement',
		name: 'addressManagement',
		component: AddressManagement,
		meta: {
			tabber: false
		}
	},
	{
		path: '/editAddress',
		name: 'editAddress',
		component: EditAddress,
		meta: {
			tabber: false
		}
	},
	{
		path: '/addAddress',
		name: 'addAddress',
		component: AddAddress,
		meta: {
			tabber: false
		}
	},
	{
		path: '/myOrder',
		name: 'myOrder',
		component: MyOrder,
		meta: {
			tabber: false
		}
	},
	{
		path: '/productDetails',
		name: 'productDetails',
		component: productDetails,
		meta: {
			tabber: false
		}
	},
	{
		path: '/searchDetail',
		name: 'searchDetail',
		component: SearchDetail,
		meta: {
			tabber: false
		}
	},
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
